package com.admin.service;

import com.data.entity.AdminMenu;
import com.data.mapper.AdminMenuMapper;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * @描述 <>
 * @参数 $params$
 * @返回值 $return$
 * @创建人 WangGuanghua
 * @创建时间 $date$
 */
@Service
public class AdminMenuService {
    @Resource
    private AdminMenuMapper adminMenuMapper;

    public List<AdminMenu> listAll() {
        return adminMenuMapper.listAll();
    }

    public int count() {
        return adminMenuMapper.count();
    }

    public int add(AdminMenu adminMenu) {
        return adminMenuMapper.insert(adminMenu);
    }

    public AdminMenu get(Long id) {
        return adminMenuMapper.getMenuById(id);
    }

    public int edit(AdminMenu adminMenu) {
        return adminMenuMapper.updateById(adminMenu);

    }

    public int delete(Long id) {
        return adminMenuMapper.deleteById(id);
    }

    public List<AdminMenu> listByRoleId(Long roleId) {
        return adminMenuMapper.getListByRole(roleId);
    }

}
